// ------------------------------------------------------------------------------------------------
// File   : DX9AfterEffect.h
// Date   : 2012-08-01
// Author : Weng xiao yi
// Descr. : 
//
// ------------------------------------------------------------------------------------------------

#ifndef OY_DX9AFTEREFFECT_H
#define OY_DX9AFTEREFFECT_H

#include "DX9ShaderUtils.h"

// ------------------------------------------------------------------------------------------------
// FORWARD DECLARATIONS
// ------------------------------------------------------------------------------------------------
class DX9VertexShader;
class DX9PixelShader;

// ------------------------------------------------------------------------------------------------
// DEFINES
// ------------------------------------------------------------------------------------------------

typedef enum
{
	eDX9_AE_Context_Read,
	eDX9_AE_Context_Write,

	eDX9_AE_Context_FloatParam,
	eDX9_AE_Context_BoolParam,

	eDX9_AE_Context_Num,

} DX9_AE_Context;


struct AfterEffectQuadVertex
{
	OyVector4D p;
};

// ------------------------------------------------------------------------------------------------
// CLASSES
// ------------------------------------------------------------------------------------------------

class DX9AfterEffect
{
public:

	DX9AfterEffect();
	virtual ~DX9AfterEffect();

	virtual void  ReInit() = 0;
	virtual void  OnDeviceLost();
	virtual void  OnDeviceReset();
	virtual void  Shutdown() = 0;
	virtual void  Apply() = 0;

	virtual void  SetParam(DX9_AE_Context _eContext, ULONG _ulParam, float _fValue) = 0;
	virtual float GetParam(DX9_AE_Context _eContext, ULONG _ulParam) = 0;

	virtual void  Enable(DX9_AE_Context _eContext, BOOL _bEnable);
	virtual BOOL  IsEnabled(DX9_AE_Context _eContext) { return m_bEnabled[_eContext]; }

	const LPDIRECT3DVERTEXDECLARATION9& GetVertexDecl() { return m_pAfterEffectDeclVD; }
	const LPDIRECT3DVERTEXBUFFER9& GetVertexBuffer() { return m_pQuadVB; }

public:

	BOOL										m_bEnabled[eDX9_AE_Context_Num];

	LPDIRECT3DVERTEXDECLARATION9				m_pAfterEffectDeclVD;
	LPDIRECT3DVERTEXBUFFER9						m_pQuadVB;			
	AfterEffectQuadVertex						m_QuadVert[4];
};

#endif // #ifdef OY_DX9AFTEREFFECT_H
